<%@ page contentType="text/html;charset=UTF-8"%>

<%@ page import="java.util.Vector,com.ejoysoft.wlanyz.business.Acceptance,com.ejoysoft.common.Constants,com.ejoysoft.common.exception.NoRightException" %>
<%@page import="sun.reflect.generics.tree.IntSignature"%>
<%@page import="com.ejoysoft.common.Format"%>
<%@ page import="java.util.List"%>
<%@ include file="../include/jsp/head.jsp"%>

<%
	if (!globa.userSession.hasRight("10060"))
		throw new NoRightException("用户不具备操作该功能模块的权限，请与系统管理员联系！");
%>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<%
	//查询条件
    String  strCity = ParamUtil.getString(request,"strCity","");
    String  strStartTime = ParamUtil.getString(request,"strStartTime","");
    String  strEndTime = ParamUtil.getString(request,"strEndTime","");
     String checked1 =  ParamUtil.getString(request,"checkedFlag","all");
	//System.out.println("查询条件："+strStartTime+"时间"+strEndTime);
	
	if(strStartTime.compareTo(strEndTime)>0)
    {
       out.print("<script>alert('起始时间大于终止时间，请重新输入');window.history.back(-1);</script>");  	
    }
	if(strStartTime.equals(""))strStartTime = "1000-01-01";
    if(strEndTime.equals(""))strEndTime = "9999-12-30"; 
	//System.out.println("查询条件："+strStartTime+"时间"+strEndTime);
	
	//初始化
	Acceptance task0 = null;
	Acceptance obj = new Acceptance(globa);
	//查询条件
	String tWhere = " and wlan_test_result.dtcreatdate between to_date('" + strStartTime + "','yyyy-MM-dd hh24.mi.ss') and to_date('" + strEndTime + "','yyyy-MM-dd hh24.mi.ss')" ;
	
	if(strCity!=""){
		tWhere += " and wlan_resc_hotpot.strcity like '%"+strCity+"%'";
	}
	
	//记录总数
	int intAllCount = obj.getCount(tWhere);
	//当前页
	int intCurPage = globa.getIntCurPage();
	//每页记录数
	String strPageSize = "10";
	int intPageSize;
	if (strPageSize.equals("所有"))
		intPageSize = intAllCount;
	else
		intPageSize = Integer.parseInt(strPageSize);
	//共有页数
	int intPageCount = (intAllCount - 1) / intPageSize + 1;
	// 循环显示一页内的记录 开始序号
	int intStartNum = (intCurPage - 1) * intPageSize + 1;
	//结束序号
	int intEndNum = intCurPage * intPageSize;
	//获取到当前页面的记录集
	Vector<Acceptance> vctObj = obj.list(tWhere, intStartNum, intPageSize);
	//获取当前页的记录条数
	int intVct = (vctObj != null && vctObj.size() > 0 ? vctObj.size(): 0);
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><%=application.getAttribute("APP_TITLE")%></title> 
<link href="../css/main.css" rel="stylesheet" type="text/css" />
<script language="JavaScript" src="../include/date/popc.js"></script>
<script src="../include/js/list.js"></script>
<script src="../include/DatePicker/WdatePicker.js"></script>
<script language="javascript">
 function check(){
           var checkboxs = document.getElementsByName("ckb");
           var rvalue = "";
           if(checkboxs.length > 0){
	           for(var i=0;i<checkboxs.length;i++){
	                if(checkboxs[i].checked == true){
	                		rvalue = rvalue + checkboxs[i].value + ",";
	                }
	           }
	           return rvalue;
           } else{
           return null;
           }
    } 
    
	 function showDetail(){
	 	var ckbValue = check();
	 	if(ckbValue != "")
	 	window.open ('accept_detail.jsp?ckb='+ckbValue,'newwindow','height=500,width=3000,top=125,left=0,toolbar=no,menubar=no,scrollbars=yes, resizable=no,location=no, status=no')
	 	else alert("请先选择任务！");
	 }
 function subm(){
  frm.submit();
 }
 function export_sbm(page){ 
  frm.action="accept_export.jsp";
  document.getElementById("strCurPage").value = "<%=intCurPage%>";
  document.getElementById("exportContent").value = page;
  frm.submit();
 }
 function showAc(){
   document.getElementById('<%=Constants.PAGE_SIZE_INDEX%>').value= "1";
  frm.submit();
 }
</script>
</head>

<body>
<form name=frm method=post action="accept_analysis.jsp">
<input id="exportFlag" name="exportFlag" type="hidden" value="exportResult"/>
<input id="strCurPage" name="strCurPage" type="hidden" value="<%=intCurPage%>"/>
<input id="exportContent" name="exportContent" type="hidden" value=""/>
<input id="checkedFlag" name="checkedFlag" type="hidden" value="<%=checked1%>"/>
<table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="30"><img src="../images/ri_list.jpg" width="14" height="14" align="bottom" />&nbsp;您现在所在的位置：<font color="#0e7cc9">测试结果分析</font> &gt;验收测试分析</td>
  </tr>
</table>

<table width="97%" border="0" align="center" cellpadding="0" cellspacing="0"> 
  <tr>
    <td height="45" valign="middle" bgcolor="e1eef7">
      <table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td width="20%">地市：
          <input type="text" name="strCity"/></td>
          <td align="left" width="40%" >请选择时间：
	          <input  name="strStartTime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'});" class="input_box" value=""style="width:100"/>-
	          <input  name="strEndTime" onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'});" class="input_box" value=""style="width:100"/>
          </td>
          <td><img src="../images/search.jpg" width="58" height="28" align="left" onclick="subm()" style="cursor:hand"/>
          </td>
          <td align="right"><input type="button" value="查看详细结果" onclick="showDetail();"/>&nbsp;&nbsp;<input type="button" value="导出"/></td>
        </tr>
      </table></td>
  </tr>
</table>

<table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
  	<td width="5%" class="listtit">&nbsp;</td>   
    <td width="5%" class="listtit">地市</td>
    <td width="5%" class="listtit">区县</td>
    <td class="listtit" width="15%">任务名称</td>
    <td width="15%" class="listtit">AP名称</td>
    <td width="15%" class="listtit">热点名称</td>
    <td width="5%" class="listtit">合格</td>
    <td width="15%" class="listtit">测试时间</td>
    <td width="20%" class="listtit">热点地址</td>
  </tr>
    <%
    	for (int i = 0;i < vctObj.size(); i++) {
    		String strid = "";
                  String strcity = "";
                  String strtown = "";
                  String strtaskname="";
                  String strapname="";
                  String strhpname="";
                  String strtext="";
                  String strtesttime="";
                  String strhotpotaddr="";
                  Acceptance obj1 = vctObj.get(i);
                  strcity= Format.forbidNull(obj1.getStrcity());
                  strtown= Format.forbidNull(obj1.getStrtown());
                  strtaskname= Format.forbidNull(obj1.getStrtaskname());
                  strapname = Format.forbidNull(obj1.getStrapname());
                  strhpname = Format.forbidNull(obj1.getStrhpname());
                  strtext = Format.forbidNull(obj1.getStrtext());
                  strtesttime = Format.forbidNull(obj1.getStrtesttime());
                  strhotpotaddr = Format.forbidNull(obj1.getStrhpaddr());
                  strid = Format.forbidNull(obj1.getStrid());
    %>

  <tr>
  	<td class="listd1" width="5%"><input type="checkbox" name="ckb" value="<%=strid %>"/></td>
    <td class="listd1" width="5%"> <%=strcity %>&nbsp;</td>
    <td class="listd1" width="5%"> <%=strtown %>&nbsp;</td>
    <td class="listd1" width="15%"><%=strtaskname%>&nbsp;</td>
    <td class="listd1" width="15%"><%=strapname %>&nbsp;</td>
    <td class="listd1" width="15%"><%=strhpname %>&nbsp;</td>
    <td class="listd1" width="5%"> <%=strtext %>&nbsp;</td>
    <td class="listd1" width="15%"> <%=strtesttime %>&nbsp;</td> 
    <td class="listd1" width="20%"> <%=strhotpotaddr %>&nbsp;</td> 
  </tr>
             <%
            }
            %>
</table>

<table width="97%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="61%" height="50" valign="bottom"><!--<img src="../images/pldel.jpg" width="83" height="27" align="absmiddle" />--> &nbsp;&nbsp;页面记录数
      <select name="strPageSize" id="strPageSize" style="width:52px;" onchange="showAc()">
		<% 
		 String sltOpt[] = {"10","20","30","50","70","100","所有"};
		 for(int i=0; i < sltOpt.length;i++){
		 	String selected = "";
		    if(sltOpt[i].equals(strPageSize))
		      selected="selected='selected'";
		 %>
		 <option value="<%=sltOpt[i] %>" <%=selected %>><%=sltOpt[i] %></option>
   		<%
   		 }
   		 %>
   		 </select>
      <img src="../images/dc.jpg" width="92" height="27" align="middle" onclick="export_sbm('currentPage')" style="cursor:hand"/> <img src="../images/dcall.jpg" width="82" height="27" align="absmiddle" onclick="export_sbm('allPage')" style="cursor:hand"/></td>
      <td>  <input id="exportFlag" name="exportFlag" type="hidden" value="exportResult"/>
       		 <input id="strCurPage" name="strCurPage" type="hidden" value=""/>
			<input id="exportContent" name="exportContent" type="hidden" value=""/></td>
    
      <td width="39%" align="right" valign="bottom"><!--<table width="310" border="0" cellspacing="0" cellpadding="0">
       <tr>
        <td width="40"><img src="../images/up.jpg" width="40" height="30" /></td>
        <td width="221" align="center" background="../images/page_bg.jpg" class="page"><a href="#">1</a>&nbsp; <a href="#">2</a>&nbsp; <a href="#">3</a>&nbsp; <a href="#"><span class="sel">4</span></a>&nbsp; <a href="#">5</a> &nbsp;<a href="#">6</a> &nbsp;<a href="#">7</a>&nbsp; <a href="#">8 </a>&nbsp;<a href="#">9</a>&nbsp;...&nbsp;<a href="#">13</a> </td>
        <td width="39"><img src="../images/down.jpg" width="39" height="30" /></td>
       </tr>
    </table>
  -->
  <!-- 翻页开始 -->  
     	<%@ include file="../include/jsp/cpage.jsp"%>
       	<!-- 翻页结束 --> </td>
  </tr>
</table>

</form>
</body>
</html>
<%@ include file="../include/jsp/footer.jsp"%>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                